package airthmetic.exercise.recursion;

public class _70_爬楼梯 {

    // 递推公式 f(n) = f(n-1) + f(n-2),其中f(1) = 1,f(2) = 2
    public static int climbStairs(int n) {
        if(n <= 2){
            return n;
        }

        return climbStairs(n-1) + climbStairs(n-2);
    }

    public static void main(String[] args) {
        System.out.println(climbStairs(5));
    }

}
